import React from 'react';
import './App.css';
// import Header from './components/Header/Header';
// import Section from './components/Section/Section';
// import Footer from './components/Footer/Footer';
// import Video from './components/Video/Video';
// import Todo from './components/Todo/Todo';
// import Duanzi from './components/Duanzi/Duanzi';
// import Hero from './components/Hero/Hero';
// import Website from './components/Website/Website';
// import Proxy from './components/Proxy/Proxy';
import { Route, BrowserRouter, Link, withRouter} from 'react-router-dom';
// import LuYou from './components/LuYou/LuYou';
// import VideoList from './pages/VideoList/VideoList';
// import VideoShow from './pages/VideoShow/VideoShow';
// import Home from './components/Home/Home';
import store from './redux/store';
import  {jiaAction, jianAction, asyncJiaAction} from './redux/actions/FansCountActions';
import {increAction, decreAction} from './redux/actions/CollCountAction';

class App extends React.Component {

    render() {
        return <div style={{padding: '90px'}}>
            <h4>当前的粉丝数 {store.getState().fans}</h4>
            <button onClick={this.minus}>减小</button> 
            <button onClick={this.add}>增加</button>    
            <button onClick={this.asyncAdd}>1s 后增加 10</button>    
            <br/>
            <br/>
            <br/>
            <h4>当前的收藏数 {store.getState().coll}</h4>
            <button onClick={() => {
                store.dispatch(increAction(1));
            }}>新增</button>

        </div>
    }

    add = () => {
        //发送任务 加 1
        store.dispatch(jiaAction(1));
    }
  
    minus = () => {
        store.dispatch(jianAction(1)); 
    }

    asyncAdd = () => {
        store.dispatch(asyncJiaAction(10));
    }

    componentDidMount(){
        console.log(store.getState());
    }

}

export default withRouter(App);
